/*
 * @Descripttion: 
 * @version: 1.0
 * @Author: LiYansheng
 * @Date: 2022-03-31 21:02:44
 * @LastEditors: CoderXZ
 * @LastEditTime: 2022-05-31 17:06:51
 */
import axios from 'axios';

const service = axios.create({
    baseURL:'http://www.liyansheng.top:8082',
    // baseURL:'http://localhost:8080',
    timeout: 5000
});

// 请求拦截器
service.interceptors.request.use(
    config => {
        config.headers.token=localStorage.getItem("token");
        return config;
    },
    error => {
        console.log(error);
        return Promise.reject();
    }
);

service.interceptors.response.use(
    response => {
        if (response.status === 200) {
            return response.data;
        } else {
            Promise.reject();
        }
    },
    error => {
        console.log(error);
        return Promise.reject();
    }
);

export default service;
